﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

namespace SportingGoodsExhibitionSystem
{
    /// <summary>
    /// AdminStuTranInfo.xaml 的交互逻辑
    /// </summary>
    public partial class AdminStuTranInfo : Window
    {
        public AdminStuTranInfo()
        {
            InitializeComponent();
        }
        int stuNum;
        public AdminStuTranInfo(int stuNum)
        {
            InitializeComponent();
            this.stuNum = stuNum;
        }

        string strCon = Properties.Resources.strCON;

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SqlConnection con = new SqlConnection(strCon);
            con.Open();
            SqlCommand cmd = new SqlCommand("select * from scheInfo where stunum=@num", con);
            cmd.Parameters.Add("@num", SqlDbType.Int, 10).Value = stuNum;
            SqlDataAdapter read = new SqlDataAdapter(cmd);
            //DataTable dt = new DataTable();
            DataSet dataset = new DataSet();
            read.Fill(dataset);
            DataTable table = dataset.Tables[0];
            DataRowCollection rows = table.Rows;
            DataRow row = rows[0];
            labelTime.Content = row["starttime"].ToString();
            labelWay.Content = row["tranway"].ToString();
            labelPlace.Content = row["goplace"].ToString();
            labelArrivePlace.Content = row["arriveplace"].ToString();
            labelAttiveTime.Content = row["endtime"].ToString();
            con.Close();

        }
    }
}
